﻿using System;
using System.Collections.Generic;
using System.Xml;
using System.Xml.Serialization;
using System.Text;

namespace UploadServer
{
	[Serializable]
	public struct ServerConfigure
	{
		public int PackageSize;
		public int MaxFileSize;
		public string ContentType;
		public int UserCertification;
		public int SameHashcodeCopy;
		public ushort ThreadWaiting;
		public HashTypes HashType;

		public int ClientHashcode;
		public ushort ClientDelay;

		[XmlIgnore]
		public bool IsEmpty
		{
			get
			{
				return PackageSize < 1
					|| MaxFileSize < 1
					|| String.IsNullOrEmpty(ContentType)
					;
			}
		}

		public static ServerConfigure _Default;
		public static ServerConfigure Default
		{
			get
			{
				if (_Default.IsEmpty)
				{
					_Default.PackageSize = 131072;
					_Default.MaxFileSize = 51200000;
					_Default.ContentType = "*/*";
					_Default.UserCertification = 1;
					_Default.SameHashcodeCopy = 1;
					_Default.ThreadWaiting = 100;
					_Default.HashType = HashTypes.SHA1;
					_Default.ClientHashcode = 1;
					_Default.ClientDelay = 100;
				}
				return _Default;
			}
		}
	}
}
